<?php

class ChooseAction extends Action {

    function _initialize() {
                import('@.ORG.Session');
        import('@.ORG.Cookie');
    }

    Public function index() {
        $id = $_GET['id'];

        if (isset($id) && ($id > 0)) {
            
            Cookie::set('city', $id, '360000');
            $this->redirect('/', array(), 0, '');
        }

        $con['type'] = '1';
        $province = D('Region')->where($con)->select();

        foreach ($province as $value) {

            $condition['parentId'] = $value['id'];
            $city[$value['name']] = D("Region")->where($condition)->select();
        }
        $this->assign("citys", $city);
        $this->display();
    }

}

?>